/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.impl;

import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.EcoreEMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.omg.deployment.Bridge;
import org.omg.deployment.DeploymentPackage;
import org.omg.deployment.DeploymentPlan;
import org.omg.deployment.DocumentRoot;
import org.omg.deployment.Domain;
import org.omg.deployment.Interconnect;
import org.omg.deployment.Node;
import org.omg.deployment.Resource;
import org.omg.deployment.SatisfierProperty;
import org.omg.deployment.SharedResource;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Document Root</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getMixed <em>Mixed</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getXSISchemaLocation <em>XSI Schema Location</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getBridge <em>Bridge</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getDeploymentPlan <em>Deployment Plan</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getDomain <em>Domain</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getInterconnect <em>Interconnect</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getNode <em>Node</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getResource <em>Resource</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getSatisfierProperty <em>Satisfier Property</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DocumentRootImpl#getSharedResource <em>Shared Resource</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DocumentRootImpl extends EObjectImpl implements DocumentRoot {
	/**
	 * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMixed()
	 * @generated
	 * @ordered
	 */
	protected FeatureMap mixed;

	/**
	 * The cached value of the '{@link #getXMLNSPrefixMap() <em>XMLNS Prefix Map</em>}' map.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getXMLNSPrefixMap()
	 * @generated
	 * @ordered
	 */
	protected EMap<String, String> xMLNSPrefixMap;

	/**
	 * The cached value of the '{@link #getXSISchemaLocation() <em>XSI Schema Location</em>}' map.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getXSISchemaLocation()
	 * @generated
	 * @ordered
	 */
	protected EMap<String, String> xSISchemaLocation;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DocumentRootImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DeploymentPackage.eINSTANCE.getDocumentRoot();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureMap getMixed() {
		if (mixed == null) {
			mixed = new BasicFeatureMap(this,
					DeploymentPackage.DOCUMENT_ROOT__MIXED);
		}
		return mixed;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EMap<String, String> getXMLNSPrefixMap() {
		if (xMLNSPrefixMap == null) {
			xMLNSPrefixMap = new EcoreEMap<String, String>(
					EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY,
					EStringToStringMapEntryImpl.class, this,
					DeploymentPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP);
		}
		return xMLNSPrefixMap;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EMap<String, String> getXSISchemaLocation() {
		if (xSISchemaLocation == null) {
			xSISchemaLocation = new EcoreEMap<String, String>(
					EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY,
					EStringToStringMapEntryImpl.class, this,
					DeploymentPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION);
		}
		return xSISchemaLocation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Bridge getBridge() {
		return (Bridge) getMixed().get(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Bridge(), true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetBridge(Bridge newBridge,
			NotificationChain msgs) {
		return ((FeatureMap.Internal) getMixed()).basicAdd(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Bridge(),
				newBridge, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBridge(Bridge newBridge) {
		((FeatureMap.Internal) getMixed())
				.set(DeploymentPackage.eINSTANCE.getDocumentRoot_Bridge(),
						newBridge);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DeploymentPlan getDeploymentPlan() {
		return (DeploymentPlan) getMixed().get(
				DeploymentPackage.eINSTANCE.getDocumentRoot_DeploymentPlan(),
				true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetDeploymentPlan(
			DeploymentPlan newDeploymentPlan, NotificationChain msgs) {
		return ((FeatureMap.Internal) getMixed()).basicAdd(
				DeploymentPackage.eINSTANCE.getDocumentRoot_DeploymentPlan(),
				newDeploymentPlan, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDeploymentPlan(DeploymentPlan newDeploymentPlan) {
		((FeatureMap.Internal) getMixed()).set(
				DeploymentPackage.eINSTANCE.getDocumentRoot_DeploymentPlan(),
				newDeploymentPlan);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Domain getDomain() {
		return (Domain) getMixed().get(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Domain(), true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetDomain(Domain newDomain,
			NotificationChain msgs) {
		return ((FeatureMap.Internal) getMixed()).basicAdd(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Domain(),
				newDomain, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDomain(Domain newDomain) {
		((FeatureMap.Internal) getMixed())
				.set(DeploymentPackage.eINSTANCE.getDocumentRoot_Domain(),
						newDomain);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Interconnect getInterconnect() {
		return (Interconnect) getMixed().get(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Interconnect(),
				true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetInterconnect(Interconnect newInterconnect,
			NotificationChain msgs) {
		return ((FeatureMap.Internal) getMixed()).basicAdd(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Interconnect(),
				newInterconnect, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInterconnect(Interconnect newInterconnect) {
		((FeatureMap.Internal) getMixed()).set(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Interconnect(),
				newInterconnect);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Node getNode() {
		return (Node) getMixed().get(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Node(), true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetNode(Node newNode, NotificationChain msgs) {
		return ((FeatureMap.Internal) getMixed()).basicAdd(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Node(), newNode,
				msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNode(Node newNode) {
		((FeatureMap.Internal) getMixed()).set(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Node(), newNode);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Resource getResource() {
		return (Resource) getMixed().get(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Resource(), true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetResource(Resource newResource,
			NotificationChain msgs) {
		return ((FeatureMap.Internal) getMixed()).basicAdd(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Resource(),
				newResource, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setResource(Resource newResource) {
		((FeatureMap.Internal) getMixed()).set(
				DeploymentPackage.eINSTANCE.getDocumentRoot_Resource(),
				newResource);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SatisfierProperty getSatisfierProperty() {
		return (SatisfierProperty) getMixed()
				.get(DeploymentPackage.eINSTANCE
						.getDocumentRoot_SatisfierProperty(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetSatisfierProperty(
			SatisfierProperty newSatisfierProperty, NotificationChain msgs) {
		return ((FeatureMap.Internal) getMixed())
				.basicAdd(DeploymentPackage.eINSTANCE
						.getDocumentRoot_SatisfierProperty(),
						newSatisfierProperty, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSatisfierProperty(SatisfierProperty newSatisfierProperty) {
		((FeatureMap.Internal) getMixed())
				.set(DeploymentPackage.eINSTANCE
						.getDocumentRoot_SatisfierProperty(),
						newSatisfierProperty);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SharedResource getSharedResource() {
		return (SharedResource) getMixed().get(
				DeploymentPackage.eINSTANCE.getDocumentRoot_SharedResource(),
				true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetSharedResource(
			SharedResource newSharedResource, NotificationChain msgs) {
		return ((FeatureMap.Internal) getMixed()).basicAdd(
				DeploymentPackage.eINSTANCE.getDocumentRoot_SharedResource(),
				newSharedResource, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSharedResource(SharedResource newSharedResource) {
		((FeatureMap.Internal) getMixed()).set(
				DeploymentPackage.eINSTANCE.getDocumentRoot_SharedResource(),
				newSharedResource);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case DeploymentPackage.DOCUMENT_ROOT__MIXED:
			return ((InternalEList<?>) getMixed()).basicRemove(otherEnd, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
			return ((InternalEList<?>) getXMLNSPrefixMap()).basicRemove(
					otherEnd, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
			return ((InternalEList<?>) getXSISchemaLocation()).basicRemove(
					otherEnd, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__BRIDGE:
			return basicSetBridge(null, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__DEPLOYMENT_PLAN:
			return basicSetDeploymentPlan(null, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__DOMAIN:
			return basicSetDomain(null, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__INTERCONNECT:
			return basicSetInterconnect(null, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__NODE:
			return basicSetNode(null, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__RESOURCE:
			return basicSetResource(null, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__SATISFIER_PROPERTY:
			return basicSetSatisfierProperty(null, msgs);
		case DeploymentPackage.DOCUMENT_ROOT__SHARED_RESOURCE:
			return basicSetSharedResource(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case DeploymentPackage.DOCUMENT_ROOT__MIXED:
			if (coreType)
				return getMixed();
			return ((FeatureMap.Internal) getMixed()).getWrapper();
		case DeploymentPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
			if (coreType)
				return getXMLNSPrefixMap();
			else
				return getXMLNSPrefixMap().map();
		case DeploymentPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
			if (coreType)
				return getXSISchemaLocation();
			else
				return getXSISchemaLocation().map();
		case DeploymentPackage.DOCUMENT_ROOT__BRIDGE:
			return getBridge();
		case DeploymentPackage.DOCUMENT_ROOT__DEPLOYMENT_PLAN:
			return getDeploymentPlan();
		case DeploymentPackage.DOCUMENT_ROOT__DOMAIN:
			return getDomain();
		case DeploymentPackage.DOCUMENT_ROOT__INTERCONNECT:
			return getInterconnect();
		case DeploymentPackage.DOCUMENT_ROOT__NODE:
			return getNode();
		case DeploymentPackage.DOCUMENT_ROOT__RESOURCE:
			return getResource();
		case DeploymentPackage.DOCUMENT_ROOT__SATISFIER_PROPERTY:
			return getSatisfierProperty();
		case DeploymentPackage.DOCUMENT_ROOT__SHARED_RESOURCE:
			return getSharedResource();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case DeploymentPackage.DOCUMENT_ROOT__MIXED:
			((FeatureMap.Internal) getMixed()).set(newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
			((EStructuralFeature.Setting) getXMLNSPrefixMap()).set(newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
			((EStructuralFeature.Setting) getXSISchemaLocation()).set(newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__BRIDGE:
			setBridge((Bridge) newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__DEPLOYMENT_PLAN:
			setDeploymentPlan((DeploymentPlan) newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__DOMAIN:
			setDomain((Domain) newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__INTERCONNECT:
			setInterconnect((Interconnect) newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__NODE:
			setNode((Node) newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__RESOURCE:
			setResource((Resource) newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__SATISFIER_PROPERTY:
			setSatisfierProperty((SatisfierProperty) newValue);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__SHARED_RESOURCE:
			setSharedResource((SharedResource) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case DeploymentPackage.DOCUMENT_ROOT__MIXED:
			getMixed().clear();
			return;
		case DeploymentPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
			getXMLNSPrefixMap().clear();
			return;
		case DeploymentPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
			getXSISchemaLocation().clear();
			return;
		case DeploymentPackage.DOCUMENT_ROOT__BRIDGE:
			setBridge((Bridge) null);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__DEPLOYMENT_PLAN:
			setDeploymentPlan((DeploymentPlan) null);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__DOMAIN:
			setDomain((Domain) null);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__INTERCONNECT:
			setInterconnect((Interconnect) null);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__NODE:
			setNode((Node) null);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__RESOURCE:
			setResource((Resource) null);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__SATISFIER_PROPERTY:
			setSatisfierProperty((SatisfierProperty) null);
			return;
		case DeploymentPackage.DOCUMENT_ROOT__SHARED_RESOURCE:
			setSharedResource((SharedResource) null);
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case DeploymentPackage.DOCUMENT_ROOT__MIXED:
			return mixed != null && !mixed.isEmpty();
		case DeploymentPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
			return xMLNSPrefixMap != null && !xMLNSPrefixMap.isEmpty();
		case DeploymentPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
			return xSISchemaLocation != null && !xSISchemaLocation.isEmpty();
		case DeploymentPackage.DOCUMENT_ROOT__BRIDGE:
			return getBridge() != null;
		case DeploymentPackage.DOCUMENT_ROOT__DEPLOYMENT_PLAN:
			return getDeploymentPlan() != null;
		case DeploymentPackage.DOCUMENT_ROOT__DOMAIN:
			return getDomain() != null;
		case DeploymentPackage.DOCUMENT_ROOT__INTERCONNECT:
			return getInterconnect() != null;
		case DeploymentPackage.DOCUMENT_ROOT__NODE:
			return getNode() != null;
		case DeploymentPackage.DOCUMENT_ROOT__RESOURCE:
			return getResource() != null;
		case DeploymentPackage.DOCUMENT_ROOT__SATISFIER_PROPERTY:
			return getSatisfierProperty() != null;
		case DeploymentPackage.DOCUMENT_ROOT__SHARED_RESOURCE:
			return getSharedResource() != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (mixed: ");
		result.append(mixed);
		result.append(')');
		return result.toString();
	}

} //DocumentRootImpl
